package com.leo.foodmaster.admin.recipe.service.impl;

import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leo.foodmaster.admin.recipe.dto.RecipeComboDetailsDTO;
import com.leo.foodmaster.admin.recipe.entity.RecipeComboDetailsEntity;
import com.leo.foodmaster.admin.recipe.mapper.RecipeComboDetailsMapper;
import com.leo.foodmaster.admin.recipe.service.IRecipeComboDetailsService;
import lombok.AllArgsConstructor;

/**
 * 套餐细表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2021-11-09
 */
@Service
@AllArgsConstructor
public class IRecipeComboDetailsServiceImpl extends ServiceImpl<RecipeComboDetailsMapper, RecipeComboDetailsEntity> implements IRecipeComboDetailsService {

	private final RecipeComboDetailsMapper recipeComboDetailsMapper;
	@Override
	public IPage<RecipeComboDetailsEntity> page(IPage<RecipeComboDetailsDTO> page, RecipeComboDetailsDTO recipeComboDetailsdto) {
			RecipeComboDetailsEntity recipeComboDetailsentity=new RecipeComboDetailsEntity();
		BeanUtil.copyProperties(recipeComboDetailsdto,recipeComboDetailsentity);
		LambdaQueryWrapper<RecipeComboDetailsEntity> eq = Wrappers.lambdaQuery(recipeComboDetailsentity);
		return recipeComboDetailsMapper.selectPage(new Page<>(page.getCurrent(),page.getSize()), eq);
	}

	@Override
	public IPage<RecipeComboDetailsDTO> pageList(IPage<RecipeComboDetailsDTO> page,RecipeComboDetailsDTO recipeComboDetailsDTO) {

		return recipeComboDetailsMapper.pageList(page,recipeComboDetailsDTO);
	}}
